﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using rock.DAL;
using rock.UI.custom;

namespace rock.UI.houseinfo
{
    public partial class UserControlImportRoomInfo : UserControl
    {
        private bool SHOW_BUTTON = false;
        public bool _SHOW_BUTTON
        {
            get { return SHOW_BUTTON; }
            set
            {
                SHOW_BUTTON = value;
                this.button2.Enabled = SHOW_BUTTON;
              
            }
        }

        private int ROOM_SEQID = 0;
        public int _ROOM_SEQID { get { return ROOM_SEQID; } set { ROOM_SEQID = value; } }

        DalHOUSE_ROOM aDalHOUSE_ROOM = new DalHOUSE_ROOM();

        public UserControlImportRoomInfo()
        {
            InitializeComponent();
        }

        public void inits(int ROOM_SEQID)
        {

            _ROOM_SEQID = ROOM_SEQID;
            DataSet ds = aDalHOUSE_ROOM.getHouseRoomInfo(_ROOM_SEQID);

            decimal ROOM_SIZE = ((decimal)ds.Tables[0].Rows[0]["ROOM_SIZE"]);
            int ALL_FLOOR_END = (int)ds.Tables[0].Rows[0]["ALL_FLOOR_END"];
            int ROOM_FLOOR = (int)ds.Tables[0].Rows[0]["ROOM_FLOOR"];
     
            String XIAOQU_NAME = (String)ds.Tables[0].Rows[0]["XIAOQU_NAME"];
            String DONG_NAME = (String)ds.Tables[0].Rows[0]["DONG_NAME"];
            String ROOM_NAME = (String)ds.Tables[0].Rows[0]["HOUSE_NAME"];

            this.textBoxXiaoQu.Text = XIAOQU_NAME;
            this.textBox2Dong.Text = DONG_NAME;
            this.textBox3Number.Text = ROOM_NAME;
            this.textBox4Dti.Text = ROOM_SIZE+"";
            this.textBox5All.Text = ALL_FLOOR_END + "";
            this.textBox6Floor.Text = ROOM_FLOOR + "";
        }

        
        // public delegate void SelectedOk(int CONTRACT_SEQID , int ROOM_SEQID , int CUSTOM_SEQID);
        public void  SelectedOk(int seqid , int type)
        {
            inits(seqid);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            FormSeleteRoom fsc = new FormSeleteRoom();
            fsc.selectedOk = SelectedOk;
            fsc.ShowDialog(this);
        }

        
     
    }
}
